<?php
  $yhendus=new mysqli("localhost", "if13", "ifikad", "if13_ulpst_p");
  if(isSet($_REQUEST["makstud_id"])){
     $kask=$yhendus->prepare("UPDATE mikrobussivedu SET arveseisund=2 WHERE id=?");
	 $kask->bind_param("i", $_REQUEST["makstud_id"]);
	 $kask->execute();
  }
  $kask=$yhendus->prepare("SELECT id,  kliendinimi, juhinimi FROM mikrobussivedu WHERE arveseisund=1");
  $kask->bind_result($id, $kliendinimi, $juhinimi);
  $kask->execute();
?>
<!doctype html>
<html>
  <head>
  
  </head>
  <body>
    <h1>Arvete maksmise kinnitamine</h1>
	<h2>Maksmata arved</h2>
	<ul>
	  <?php
	     while($kask->fetch()){
		   echo "<li>$kliendinimi, $juhinimi<a href='?makstud_id=$id'>Makstud</a></li>";
		 }
	  ?>
	</ul>
  </body>
</html>